In a graphical user interface on a computer system, a user can continuously resize a window until the window has a desirable size. For example, the user may drag a portion of the border of a window to change the size of the window continuously (e.g., press down and hold a button of a mouse when the cursor is on the portion of the border, and move the mouse while holding down the button). The change is finalized when the user releases the dragged portion of the border (e.g., release the button which was held down during dragging the border).
On some systems, when the size of the window is continuously changed, only a rectangle is displayed to indicate the current position of the border of the window. After the change is finalized, the window is redrawn to show the contents in the window of the new size.
On other systems, live resizing is performed. When the size of the window is continuously changed, the window is redrawn a number of times to show the contents in the window changing size as the window is continuously resized. Since live resizing shows the changing contents in the window as the window is continuously resized, live resizing provides better feedback to the user than merely redrawing the border of the window to show the changing size of the window.
In a buffered windows system, resizing a window is expensive because a new buffer is allocated and the new content for the window is filled into the allocated buffer. The problem is particularly problematic for live resizing, as any delay is directly experienced by the user.
FIG. 2 illustrates a buffered window system. In a buffered window system, applications draw contents in the window buffers; and the window system combines the images buffered in window buffers in a frame buffer to display the corresponding windows on the screen. For example, application software 201 draws contents in window buffer 215, which is typically allocated from system memory 211 (e.g., volatile RAM 105 in FIG. 1). When the size of the window is changed, a new window buffer is allocated to replace the old one in order to accommodate the window of the new size. Frame buffer 221 contains data for the screen image of the windows that are displayed on the screen of display device 205. When the window for application software 201 is moved on the screen, the content in the window is not changed; and the application software does not have to update window buffer 215. The window system copies the data in the window buffer to the correct position in frame buffer 221 to display the window in the new location on the screen. When the window is partially covered by other windows, a portion of data in window buffer 215 is copied onto the frame buffer to display the corresponding portion of the window that is visible. Frame buffer 221 is typically under control of graphics hardware 203 (e.g., graphics/video card) which controls the display of the windows on the screen of display device 205 using the data in the frame buffer.
Thus, in a buffered window system, operations for creating the contents in windows are separated from operations for composing a screen image from images of windows for different applications. Applications create (or update) images of the windows (contents for the windows) in window buffers; and the window system composes a screen image from images of the windows in the window buffers. The window buffers are independent from the frame buffer.
For illustration purpose, window buffers are illustrated in various Figures (FIGS. 3-10) at the locations in the frame buffers where the corresponding windows are displayed. It will be understood that such illustrations indicate that contents in the corresponding window buffers can be copied by the window system to the corresponding locations in the frame buffers to display the windows in these locations. It will be understood that these window buffers are not part of the frame buffers.
FIGS. 3-5 illustrate a prior art scenario of resizing a buffered window. In FIG. 3, window buffer 303 is shown on top of the portion of the frame buffer where the window is displayed before a resizing operation. When the user causes cursor 307 to drag grow box 305 (e.g., pressing and holding down a mouse button while the cursor is over the grow box and moving the mouse, or using keyboards or other input devices to provide similar inputs), the user starts to resize the window. Window 303 contains area 311 for displaying contents (e.g., list of folders or files in a folder) and scroll bar 313. The position and the size of thumb 315, with respect to the scroll bar, indicate the position and the size of the portion of the content visible in area 311 with respect to the entire content. When the window is resized to the size as indicated by the position of cursor 407 in FIG. 4, new window buffer 403 is allocated for the window according to the current size of the window. Then, the application updates new window buffer 403 to display the image of the window after resizing, as shown in FIG. 5. Since a portion of window is not changed after resizing, the data for that portion is copied from the old window buffer into the new window buffer; and the portion that is changed after resizing is redrawn by the application in the new window buffer. After the data is copied from the old window buffer to the new window buffer, the old window buffer is freed (or released) so that the memory allocated for the old window buffer can be used for other purposes. For example, the content in area 511 is not changed after resizing. Thus, the data in area 311 of window buffer 303 is copied into area 511 in window buffer 403. Then, window buffer 303 is freed. Area 517 is drawn, and scroll bar area 513 is redrawn, to display additional contents visible in area 517 and to indicate the updated position and size of the portion displayed in the visible area versus the entire content. When window buffer 403 is updated, the application can ask the window system to flush the contents in the window buffer to frame buffer 301 to actually display the image of the window.